﻿Imports VN.INS.BL.BC
Imports System.Data

Partial Class Devida_ReportePoasCompletitud
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Not (Page.IsPostBack)) Then            
            'ListaPeriodo()
            CargarGrilla()
        End If
    End Sub

    'Private Sub ListaPeriodo()
    '    'carga de combo periodo
    '    Dim objGeneral As GeneralBC
    '    Dim objData As DataTable
    '    objGeneral = New GeneralBC
    '    objData = New DataTable
    '    objData = objGeneral.ListaPeriodoReporte("1", "DESC", Session("Año"))
    '    If objData.Rows.Count = 0 Then
    '        Dim drusuariorow As DataRow = objData.NewRow()
    '        drusuariorow("DESCRIPCION") = "No hay periodo activo"
    '        drusuariorow("PERIODO") = ""
    '        objData.Rows.Add(drusuariorow)
    '    End If
    '    ddlPeriodo.DataSource = objData
    '    ddlPeriodo.DataTextField = "DESCRIPCION"
    '    ddlPeriodo.DataValueField = "PERIODO"
    '    ddlPeriodo.DataBind()
    '    ddlPeriodo.SelectedIndex = 0
    'End Sub

    Private Sub CargarGrilla()
        'carga de grilla reportes incompletos
        Dim objReporte As ReporteBC
        Dim objDt As DataTable
        objReporte = New ReporteBC
        objDt = New DataTable
        'If ddlPeriodo.SelectedValue.ToString = "" Then
        'Else
        objDt = objReporte.CargarPoaCompletitud("2013")
        gvPoaCompletitud.DataSource = objDt
        gvPoaCompletitud.DataBind()
        'End If
    End Sub

    'Private _total As Int16
    Protected Sub gvPoaCompletitud_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvPoaCompletitud.RowDataBound
        'Damos formato a grilla
        If e.Row.RowType = DataControlRowType.DataRow Then
            '_total = _total + Convert.ToInt16(e.Row.Cells(1).Text.ToString)


            'Esto es para el campo PPER
            If e.Row.Cells(0).Text = "PIRDAIS" Then
                'e.Row.Cells(0).BackColor = Drawing.Color.Red
                e.Row.Cells(0).BackColor = Drawing.Color.FromName("#92d050")
            End If
            If e.Row.Cells(0).Text = "PTCD" Then
                'e.Row.Cells(2).ForeColor = Drawing.Color.White
                e.Row.Cells(0).BackColor = Drawing.Color.FromName("#ccc0da")
            End If
            If e.Row.Cells(0).Text = "PPCOD" Then
                'e.Row.Cells(2).ForeColor = Drawing.Color.White
                e.Row.Cells(0).BackColor = Drawing.Color.FromName("#b7dee8")
            End If


            If e.Row.Cells(8).Text = "FALTA" Then 'Programación  física
                'e.Row.Cells(2).ForeColor = Drawing.Color.White
                e.Row.Cells(8).ForeColor = Drawing.Color.FromName("#F00000")
            End If

            If e.Row.Cells(9).Text = "FALTA" Then 'Programación  financiera
                'e.Row.Cells(2).ForeColor = Drawing.Color.White
                e.Row.Cells(9).ForeColor = Drawing.Color.FromName("#F00000")
            End If


        ElseIf e.Row.RowType = DataControlRowType.Footer Then
            e.Row.Cells(0).Font.Bold = True
            e.Row.Cells(0).Style("font-size") = "8pt"
            'e.Row.Cells(0).Text = "Total faltante"
            e.Row.Cells(1).Font.Bold = True
            e.Row.Cells(1).Style("font-size") = "8pt"
            'e.Row.Cells(1).Text = _total.ToString
            e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
        End If
    End Sub

End Class
